package com.api.syh56.shengyunhui.service;

import cn.hutool.core.date.DateTime;
import com.api.syh56.shengyunhui.entity.Quote;
import com.api.syh56.shengyunhui.entity.SystemMessage;
import com.api.syh56.shengyunhui.entity.Waybill;
import com.api.syh56.shengyunhui.eunm.SystemMessageEunm;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.scheduling.annotation.Async;

import java.time.LocalDate;
import java.time.LocalDateTime;

public interface SystemMessageService extends IService<SystemMessage> {

    void newMessage(Long senderId, Long receiverId, SystemMessageEunm systemMessageEunm, String message, Long waybillId);

    void deleteMessage(Long id);


    SystemMessage readMessage(Long id);

    /**
     * 一键全部已读
     */
    void readAllMessage(Long receiverId);

    Page<SystemMessage> getAllMessage(Long receiverId, Integer pageNum, Integer pageSize);

    Page<SystemMessage> getReceivedMessageNotRead(Long receiverId, Integer pageNum, Integer pageSize);

    Page<SystemMessage> getReceivedMessageisRead(Long receiverId, Integer pageNum, Integer pageSize);

    /**
     * 货源推荐
     * @param waybill
     */
    @Async
    //不可以异步操作，会导致 查询不到运单的发货地址和收货地址，没法进行匹配
    void SendMessageToDriverWhenSameAddress(Waybill waybill);

    /**
     * 超时推送货源
     */
    @Async
    void SendMessageToDriverTimeOut(Waybill waybill);

    /**
     * 修改报价
     * @param quote
     */
    @Async
    void SendMessageToUpdateQuote(Waybill waybill, Quote quote);

    /**
     * 已有报价
     * @param waybill
     * @param quote
     */
    @Async
    void SendMessageToShiperWhenDriverQuote(Waybill waybill, Quote quote);

    /**
     * 已付定金
     * @param quote
     */
    @Async
    void SendMessageToDriverWhenQuotePaid( Quote quote);

    /**
     * 等待结算
     * @param waybill
     */
    @Async
    void SendMessageToShiperWhenWaybillFinish(Waybill waybill);


    /**
     * 超时未装货
     */
    @Async
    void SendMessageToDriverWhenTimeout(Waybill waybill);

    /**
     * 发送短信消息
     */
    void sendSmsMessage(String phoneNumber, String address1, String address2, String status, String phone,String car);

    //省运慧提醒您，您的运单${waybillNum}，从${address1}到${address2}的运单已${status}，车牌号码为${car}，欢迎您的使用！您的信任是我们一生的追求，服务电话${phone}。
    void sendSmsShipMessage(String phoneNumber,String WaybillNum,String address1, String address2, String status, String phone, String car);

    //省运慧提醒您，您的运单${waybillNum}，从${address1}到${address2}的运单${status}，车牌号码是${car}，感谢您的使用！
    void sendSmsReceiveMessage(String phoneNumber, String WaybillNum, String address1, String address2, String status, String car);

    //您于${time}提交的提现申请审核已通过。
    void sendWithDrawSuccess(Long uid, String time);

    //您于${time}提交的提现申请审核失败，失败原因：${message}。
    void sendWithDrawFailed(Long uid, String time, String message);


    void removeN();
}
